using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using SalesPages.DomainModel;
namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class MobileTopRotatorMap : EntityTypeConfiguration<MobileTopRotator>
    {
        public MobileTopRotatorMap()
        {
            // Primary Key
            this.HasKey(t => t.MobileTR_id);

            // Properties
            this.Property(t => t.CityCode)
                .HasMaxLength(50);

            this.Property(t => t.Country)
                .HasMaxLength(2);

            // Table & Column Mappings
            this.ToTable("MobileTopRotator");
            this.Property(t => t.MobileTR_id).HasColumnName("MobileTR_id");
            this.Property(t => t.CityCode).HasColumnName("CityCode");
            this.Property(t => t.Country).HasColumnName("Country");
            this.Property(t => t.IsActive).HasColumnName("IsActive");
            this.Property(t => t.MobileTRContent_id).HasColumnName("MobileTRContent_id");
            this.Property(t => t.DisplayOrder).HasColumnName("DisplayOrder");
            this.Property(t => t.InsertDate).HasColumnName("InsertDate");
            this.Property(t => t.UpdateDate).HasColumnName("UpdateDate");
            this.Property(t => t.AgeGroup).HasColumnName("AgeGroup");

            // Relationships
            this.HasRequired(t => t.MobileTopRotatorContent)
                .WithMany(t => t.MobileTopRotators)
                .HasForeignKey(d => d.MobileTRContent_id);

        }
    }
}
